package com.diyphonegadgets.freeblog.ui.actionbar;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils.StringSplitter;
import android.view.View;

import com.actionbarsherlock.view.ActionProvider;
import com.diyphonegadgets.freeblog.R;
import com.diyphonegadgets.freeblog.activity.DIYPhoneGadgetsBlogActivity;

public class ShareArticleActionProvider extends ActionProvider {

	/** Context for accessing resources. */
	private final Context mContext;
	boolean x = false;

	/**
	 * Creates a new instance.
	 * 
	 * @param context
	 *            Context for accessing resources.
	 */

	public ShareArticleActionProvider(Context context) {
		super(context);
		mContext = context;

	}

	
	@Override
	public boolean onPerformDefaultAction() {
		// This is called if the host menu item placed in the overflow menu of
		// the
		// action bar is clicked and the host activity did not handle the click.
		Intent intent = new Intent(Intent.ACTION_SEND);
		intent.setType("text/plain");
		intent.putExtra(Intent.EXTRA_SUBJECT, DIYPhoneGadgetsBlogActivity.getFragmentInterface().getArticleTitle());
		intent.putExtra(Intent.EXTRA_TEXT, DIYPhoneGadgetsBlogActivity.getFragmentInterface().getArticleTitle()+":\n"+DIYPhoneGadgetsBlogActivity.getFragmentInterface().getArticleURL());
		mContext.startActivity(Intent.createChooser(intent, "Share this article..."));
		return true;
	}


	@Override
	public View onCreateActionView() {
		// TODO Auto-generated method stub
		return null;
	}
}